package p400.srm466;

import utils.ExampleRunner;

/**
 * Created by IntelliJ IDEA.
 * User: smalex
 * Date: 28.04.2010
 * Time: 9:21:24
 */
public class LotteryTicketTest {
  public static void main(String[] args) {
    ExampleRunner.eq(1, "POSSIBLE", new LotteryTicket().buy(10, 1, 5, 10, 50));
    ExampleRunner.eq(2, "POSSIBLE", new LotteryTicket().buy(15, 1, 5, 10, 50));
    ExampleRunner.eq(3, "POSSIBLE", new LotteryTicket().buy(65, 1, 5, 10, 50));
    ExampleRunner.eq(4, "POSSIBLE", new LotteryTicket().buy(66, 1, 5, 10, 50));
    ExampleRunner.eq(5, "IMPOSSIBLE", new LotteryTicket().buy(1000, 999, 998, 997, 996));
    ExampleRunner.eq(6, "POSSIBLE", new LotteryTicket().buy(20, 5, 5, 5, 5));
    ExampleRunner.eq(7, "IMPOSSIBLE", new LotteryTicket().buy(20, 5, 5, 5, 6));
    ExampleRunner.eq(8, "IMPOSSIBLE", new LotteryTicket().buy(400, 1000, 1000, 1000, 1000));
    ExampleRunner.eq(9, "POSSIBLE", new LotteryTicket().buy(10, 2, 8, 5, 1));
    ExampleRunner.eq(10, "IMPOSSIBLE", new LotteryTicket().buy(65, 25, 79, 59, 63));
    ExampleRunner.eq(11, "IMPOSSIBLE", new LotteryTicket().buy(962, 706, 146, 282, 828));
    ExampleRunner.eq(12, "POSSIBLE", new LotteryTicket().buy(2, 2, 6, 3, 8));
    ExampleRunner.eq(13, "POSSIBLE", new LotteryTicket().buy(37, 37, 92, 5, 3));
    ExampleRunner.eq(14, "POSSIBLE", new LotteryTicket().buy(154, 154, 293, 383, 422));
    ExampleRunner.eq(15, "POSSIBLE", new LotteryTicket().buy(9, 7, 9, 6, 8));
    ExampleRunner.eq(16, "POSSIBLE", new LotteryTicket().buy(72, 27, 72, 39, 70));
    ExampleRunner.eq(17, "POSSIBLE", new LotteryTicket().buy(668, 913, 668, 300, 36));
    ExampleRunner.eq(18, "POSSIBLE", new LotteryTicket().buy(9, 5, 4, 2, 3));
    ExampleRunner.eq(19, "POSSIBLE", new LotteryTicket().buy(108, 34, 74, 65, 42));
    ExampleRunner.eq(20, "POSSIBLE", new LotteryTicket().buy(966, 712, 254, 869, 548));
    ExampleRunner.eq(21, "POSSIBLE", new LotteryTicket().buy(8, 5, 3, 8, 8));
    ExampleRunner.eq(22, "POSSIBLE", new LotteryTicket().buy(42, 60, 24, 42, 30));
    ExampleRunner.eq(23, "POSSIBLE", new LotteryTicket().buy(36, 779, 317, 36, 191));
    ExampleRunner.eq(24, "POSSIBLE", new LotteryTicket().buy(10, 3, 9, 7, 1));
    ExampleRunner.eq(25, "POSSIBLE", new LotteryTicket().buy(92, 43, 65, 49, 47));
    ExampleRunner.eq(26, "POSSIBLE", new LotteryTicket().buy(1536, 806, 891, 730, 371));
    ExampleRunner.eq(27, "POSSIBLE", new LotteryTicket().buy(9, 1, 7, 2, 4));
    ExampleRunner.eq(28, "POSSIBLE", new LotteryTicket().buy(54, 49, 30, 24, 85));
    ExampleRunner.eq(29, "POSSIBLE", new LotteryTicket().buy(1598, 955, 757, 841, 967));
    ExampleRunner.eq(30, "POSSIBLE", new LotteryTicket().buy(18, 7, 2, 9, 5));
    ExampleRunner.eq(31, "POSSIBLE", new LotteryTicket().buy(91, 40, 27, 24, 38));
    ExampleRunner.eq(32, "POSSIBLE", new LotteryTicket().buy(741, 539, 119, 83, 930));
    ExampleRunner.eq(33, "POSSIBLE", new LotteryTicket().buy(10, 2, 4, 6, 10));
    ExampleRunner.eq(34, "POSSIBLE", new LotteryTicket().buy(78, 59, 5, 31, 78));
    ExampleRunner.eq(35, "POSSIBLE", new LotteryTicket().buy(22, 307, 674, 387, 22));
    ExampleRunner.eq(36, "POSSIBLE", new LotteryTicket().buy(7, 6, 5, 3, 1));
    ExampleRunner.eq(37, "POSSIBLE", new LotteryTicket().buy(128, 30, 78, 74, 98));
    ExampleRunner.eq(38, "POSSIBLE", new LotteryTicket().buy(675, 513, 987, 291, 162));
    ExampleRunner.eq(39, "POSSIBLE", new LotteryTicket().buy(12, 7, 6, 8, 6));
    ExampleRunner.eq(40, "POSSIBLE", new LotteryTicket().buy(83, 75, 32, 53, 51));
    ExampleRunner.eq(41, "POSSIBLE", new LotteryTicket().buy(1909, 151, 942, 725, 967));
    ExampleRunner.eq(42, "POSSIBLE", new LotteryTicket().buy(17, 1, 8, 2, 8));
    ExampleRunner.eq(43, "POSSIBLE", new LotteryTicket().buy(150, 38, 58, 88, 54));
    ExampleRunner.eq(44, "POSSIBLE", new LotteryTicket().buy(1540, 384, 946, 910, 210));
    ExampleRunner.eq(45, "POSSIBLE", new LotteryTicket().buy(12, 9, 2, 9, 3));
    ExampleRunner.eq(46, "POSSIBLE", new LotteryTicket().buy(45, 47, 7, 31, 14));
    ExampleRunner.eq(47, "POSSIBLE", new LotteryTicket().buy(1355, 169, 901, 592, 763));
    ExampleRunner.eq(48, "POSSIBLE", new LotteryTicket().buy(21, 6, 1, 10, 5));
    ExampleRunner.eq(49, "POSSIBLE", new LotteryTicket().buy(218, 38, 49, 84, 96));
    ExampleRunner.eq(50, "POSSIBLE", new LotteryTicket().buy(685, 42, 603, 351, 292));
    ExampleRunner.eq(51, "POSSIBLE", new LotteryTicket().buy(13, 7, 5, 1, 7));
    ExampleRunner.eq(52, "POSSIBLE", new LotteryTicket().buy(218, 22, 49, 100, 69));
    ExampleRunner.eq(53, "POSSIBLE", new LotteryTicket().buy(1071, 485, 282, 735, 54));
    ExampleRunner.eq(54, "POSSIBLE", new LotteryTicket().buy(29, 10, 9, 9, 1));
    ExampleRunner.eq(55, "POSSIBLE", new LotteryTicket().buy(214, 89, 28, 68, 29));
    ExampleRunner.eq(56, "POSSIBLE", new LotteryTicket().buy(2835, 894, 649, 484, 808));
    ExampleRunner.eq(57, "POSSIBLE", new LotteryTicket().buy(4000, 1000, 1000, 1000, 1000));
    ExampleRunner.eq(58, "IMPOSSIBLE", new LotteryTicket().buy(4000, 1000, 999, 1000, 1000));
    ExampleRunner.eq(59, "IMPOSSIBLE", new LotteryTicket().buy(2, 1, 5, 10, 50));
    ExampleRunner.eq(60, "IMPOSSIBLE", new LotteryTicket().buy(20, 42, 18, 35, 1));
    ExampleRunner.eq(61, "IMPOSSIBLE", new LotteryTicket().buy(65, 25, 79, 59, 63));
    ExampleRunner.eq(62, "IMPOSSIBLE", new LotteryTicket().buy(62, 6, 96, 32, 28));
    ExampleRunner.eq(63, "IMPOSSIBLE", new LotteryTicket().buy(37, 92, 196, 143, 28));
    ExampleRunner.eq(64, "IMPOSSIBLE", new LotteryTicket().buy(43, 142, 105, 153, 154));
    ExampleRunner.eq(65, "IMPOSSIBLE", new LotteryTicket().buy(96, 83, 22, 117, 219));
    ExampleRunner.eq(66, "IMPOSSIBLE", new LotteryTicket().buy(120, 198, 27, 72, 339));
    ExampleRunner.eq(67, "IMPOSSIBLE", new LotteryTicket().buy(295, 313, 68, 300, 236));
    ExampleRunner.eq(68, "IMPOSSIBLE", new LotteryTicket().buy(124, 354, 412, 273, 184));
    ExampleRunner.eq(69, "IMPOSSIBLE", new LotteryTicket().buy(369, 165, 142, 212, 254));
    ExampleRunner.eq(70, "IMPOSSIBLE", new LotteryTicket().buy(238, 248, 145, 213, 308));
    ExampleRunner.eq(71, "IMPOSSIBLE", new LotteryTicket().buy(179, 260, 324, 142, 530));
    ExampleRunner.eq(72, "IMPOSSIBLE", new LotteryTicket().buy(289, 617, 436, 91, 543));
    ExampleRunner.eq(73, "IMPOSSIBLE", new LotteryTicket().buy(249, 7, 641, 543, 365));
    ExampleRunner.eq(74, "IMPOSSIBLE", new LotteryTicket().buy(371, 447, 556, 141, 730));
    ExampleRunner.eq(75, "IMPOSSIBLE", new LotteryTicket().buy(349, 151, 607, 702, 394));
    ExampleRunner.eq(76, "IMPOSSIBLE", new LotteryTicket().buy(57, 80, 724, 285, 405));
    ExampleRunner.eq(77, "IMPOSSIBLE", new LotteryTicket().buy(209, 141, 467, 177, 432));
    ExampleRunner.eq(78, "IMPOSSIBLE", new LotteryTicket().buy(788, 795, 140, 877, 874));
    ExampleRunner.eq(79, "IMPOSSIBLE", new LotteryTicket().buy(542, 539, 119, 83, 930));
    ExampleRunner.eq(80, "IMPOSSIBLE", new LotteryTicket().buy(8, 1, 1, 1, 1));
    ExampleRunner.eq(81, "POSSIBLE", new LotteryTicket().buy(7, 1, 1, 3, 4));
    ExampleRunner.eq(82, "POSSIBLE", new LotteryTicket().buy(30, 10, 5, 10, 10));
    ExampleRunner.eq(83, "POSSIBLE", new LotteryTicket().buy(200, 1, 2, 199, 872));
    ExampleRunner.eq(84, "POSSIBLE", new LotteryTicket().buy(10, 3, 5, 5, 6));
    ExampleRunner.eq(85, "POSSIBLE", new LotteryTicket().buy(1000, 250, 1, 500, 250));
    ExampleRunner.eq(86, "POSSIBLE", new LotteryTicket().buy(8, 2, 6, 7, 10));
    ExampleRunner.eq(87, "POSSIBLE", new LotteryTicket().buy(1, 1, 1, 1, 1));
    ExampleRunner.eq(88, "POSSIBLE", new LotteryTicket().buy(18, 1, 1, 9, 9));
    ExampleRunner.eq(89, "POSSIBLE", new LotteryTicket().buy(5, 10, 10, 2, 3));
    ExampleRunner.eq(90, "IMPOSSIBLE", new LotteryTicket().buy(8, 100, 100, 100, 2));
    ExampleRunner.eq(91, "POSSIBLE", new LotteryTicket().buy(3, 1, 1, 1, 7));
    ExampleRunner.eq(92, "POSSIBLE", new LotteryTicket().buy(11, 2, 5, 10, 1));
    ExampleRunner.eq(93, "POSSIBLE", new LotteryTicket().buy(6, 1, 3, 1, 3));
    ExampleRunner.eq(94, "POSSIBLE", new LotteryTicket().buy(10, 1, 2, 3, 4));
    ExampleRunner.eq(95, "IMPOSSIBLE", new LotteryTicket().buy(20, 1, 1, 1, 2));
    ExampleRunner.eq(96, "POSSIBLE", new LotteryTicket().buy(15, 1, 2, 3, 15));
    ExampleRunner.eq(97, "POSSIBLE", new LotteryTicket().buy(9, 3, 4, 5, 6));
    ExampleRunner.eq(98, "POSSIBLE", new LotteryTicket().buy(10, 2, 100, 12, 8));
    ExampleRunner.eq(99, "POSSIBLE", new LotteryTicket().buy(6, 2, 2, 2, 5));
    ExampleRunner.eq(100, "POSSIBLE", new LotteryTicket().buy(100, 25, 25, 101, 50));
    ExampleRunner.eq(101, "POSSIBLE", new LotteryTicket().buy(100, 10, 20, 50, 40));
    ExampleRunner.eq(102, "POSSIBLE", new LotteryTicket().buy(1004, 1, 2, 3, 1000));
    ExampleRunner.eq(103, "POSSIBLE", new LotteryTicket().buy(10, 1, 2, 30, 7));
    ExampleRunner.eq(104, "POSSIBLE", new LotteryTicket().buy(10, 5, 5, 2, 3));
    ExampleRunner.eq(105, "POSSIBLE", new LotteryTicket().buy(4, 1, 2, 5, 3));
    ExampleRunner.eq(106, "POSSIBLE", new LotteryTicket().buy(14, 1, 3, 5, 10));
    ExampleRunner.eq(107, "POSSIBLE", new LotteryTicket().buy(18, 5, 6, 1, 7));
    ExampleRunner.eq(108, "POSSIBLE", new LotteryTicket().buy(60, 30, 1000, 30, 1000));
    ExampleRunner.eq(109, "POSSIBLE", new LotteryTicket().buy(2, 1, 10, 1, 10));
    ExampleRunner.eq(110, "POSSIBLE", new LotteryTicket().buy(5, 2, 9, 9, 3));
    ExampleRunner.eq(111, "POSSIBLE", new LotteryTicket().buy(6, 2, 2, 3, 4));
    ExampleRunner.eq(112, "POSSIBLE", new LotteryTicket().buy(18, 18, 1, 1, 1));
    ExampleRunner.eq(113, "POSSIBLE", new LotteryTicket().buy(10, 5, 1, 1, 5));
    ExampleRunner.eq(114, "POSSIBLE", new LotteryTicket().buy(16, 1, 5, 12, 15));
    ExampleRunner.eq(115, "POSSIBLE", new LotteryTicket().buy(100, 30, 1, 20, 50));
    ExampleRunner.eq(116, "POSSIBLE", new LotteryTicket().buy(20, 10, 1, 1, 10));
    ExampleRunner.eq(117, "POSSIBLE", new LotteryTicket().buy(500, 200, 100, 300, 1));
    ExampleRunner.eq(118, "POSSIBLE", new LotteryTicket().buy(2, 1, 2, 3, 4));
    ExampleRunner.eq(119, "POSSIBLE", new LotteryTicket().buy(3, 1, 2, 5, 6));
    ExampleRunner.eq(120, "POSSIBLE", new LotteryTicket().buy(67, 30, 80, 37, 80));
    ExampleRunner.eq(121, "POSSIBLE", new LotteryTicket().buy(3, 1, 55, 1, 1));
    ExampleRunner.eq(122, "POSSIBLE", new LotteryTicket().buy(50, 1, 5, 10, 50));
    ExampleRunner.eq(123, "POSSIBLE", new LotteryTicket().buy(17, 2, 3, 5, 7));
    ExampleRunner.eq(124, "POSSIBLE", new LotteryTicket().buy(10, 5, 4, 3, 2));
    ExampleRunner.eq(125, "POSSIBLE", new LotteryTicket().buy(1000, 900, 5, 100, 800));
    ExampleRunner.eq(126, "POSSIBLE", new LotteryTicket().buy(100, 1, 2, 3, 100));
    ExampleRunner.eq(127, "POSSIBLE", new LotteryTicket().buy(5, 1, 3, 122, 1));
    ExampleRunner.eq(128, "POSSIBLE", new LotteryTicket().buy(3, 1, 100, 1, 1));
    ExampleRunner.eq(129, "POSSIBLE", new LotteryTicket().buy(10, 1, 4, 9, 100));
    ExampleRunner.eq(130, "IMPOSSIBLE", new LotteryTicket().buy(4, 1, 2, 100, 200));
    ExampleRunner.eq(131, "POSSIBLE", new LotteryTicket().buy(100, 1, 50, 1, 50));
    ExampleRunner.eq(132, "POSSIBLE", new LotteryTicket().buy(10, 2, 3, 8, 11));
    ExampleRunner.eq(133, "POSSIBLE", new LotteryTicket().buy(8, 1, 2, 3, 4));
    ExampleRunner.eq(134, "POSSIBLE", new LotteryTicket().buy(30, 1, 9, 11, 20));
    ExampleRunner.eq(135, "POSSIBLE", new LotteryTicket().buy(20, 1, 8, 2, 11));
    ExampleRunner.eq(136, "POSSIBLE", new LotteryTicket().buy(3, 1, 4, 1, 1));
    ExampleRunner.eq(137, "IMPOSSIBLE", new LotteryTicket().buy(100, 1, 2, 1, 1));
    ExampleRunner.eq(138, "POSSIBLE", new LotteryTicket().buy(50, 5, 10, 20, 25));
    ExampleRunner.eq(139, "POSSIBLE", new LotteryTicket().buy(100, 90, 1, 1, 10));
    ExampleRunner.eq(140, "POSSIBLE", new LotteryTicket().buy(6, 2, 1, 2, 2));
    ExampleRunner.eq(141, "POSSIBLE", new LotteryTicket().buy(5, 1, 2, 4, 100));
    ExampleRunner.eq(142, "POSSIBLE", new LotteryTicket().buy(11, 2, 5, 4, 10));
    ExampleRunner.eq(143, "POSSIBLE", new LotteryTicket().buy(17, 10, 3, 4, 5));
    ExampleRunner.eq(144, "POSSIBLE", new LotteryTicket().buy(400, 100, 100, 100, 400));
    ExampleRunner.eq(145, "POSSIBLE", new LotteryTicket().buy(5, 4, 3, 2, 2));
    ExampleRunner.eq(146, "POSSIBLE", new LotteryTicket().buy(11, 5, 6, 10, 50));
    ExampleRunner.eq(147, "POSSIBLE", new LotteryTicket().buy(300, 100, 1, 100, 100));
    ExampleRunner.eq(148, "POSSIBLE", new LotteryTicket().buy(3, 1, 1, 7, 1));
    ExampleRunner.eq(149, "POSSIBLE", new LotteryTicket().buy(100, 50, 1, 50, 1));
    ExampleRunner.eq(150, "IMPOSSIBLE", new LotteryTicket().buy(20, 1, 10, 1, 1));
    ExampleRunner.eq(151, "POSSIBLE", new LotteryTicket().buy(50, 20, 20, 30, 40));
    ExampleRunner.eq(152, "POSSIBLE", new LotteryTicket().buy(50, 45, 1, 25, 25));
    ExampleRunner.eq(153, "POSSIBLE", new LotteryTicket().buy(5, 1, 2, 4, 9));
    ExampleRunner.eq(154, "POSSIBLE", new LotteryTicket().buy(67, 30, 80, 27, 10));
    ExampleRunner.eq(155, "POSSIBLE", new LotteryTicket().buy(6, 2, 4, 100, 100));
    ExampleRunner.eq(156, "POSSIBLE", new LotteryTicket().buy(11, 1, 5, 10, 2));
    ExampleRunner.eq(157, "POSSIBLE", new LotteryTicket().buy(100, 25, 101, 25, 50));
    ExampleRunner.eq(158, "POSSIBLE", new LotteryTicket().buy(10, 1, 2, 20, 7));
    ExampleRunner.eq(159, "POSSIBLE", new LotteryTicket().buy(30, 10, 1, 10, 10));
    ExampleRunner.eq(160, "POSSIBLE", new LotteryTicket().buy(10, 10, 1, 2, 3));
    ExampleRunner.eq(161, "POSSIBLE", new LotteryTicket().buy(20, 10, 7, 6, 4));
    ExampleRunner.eq(162, "POSSIBLE", new LotteryTicket().buy(1011, 1, 10, 100, 1000));
    ExampleRunner.eq(163, "POSSIBLE", new LotteryTicket().buy(11, 1, 5, 10, 50));
    ExampleRunner.eq(164, "POSSIBLE", new LotteryTicket().buy(15, 5, 5, 5, 9));
    ExampleRunner.eq(165, "POSSIBLE", new LotteryTicket().buy(17, 10, 5, 4, 3));
    ExampleRunner.eq(166, "POSSIBLE", new LotteryTicket().buy(20, 2, 3, 1, 15));
    ExampleRunner.eq(167, "POSSIBLE", new LotteryTicket().buy(7, 1, 4, 6, 9));
    ExampleRunner.eq(168, "POSSIBLE", new LotteryTicket().buy(30, 10, 1, 2, 20));
    ExampleRunner.eq(169, "POSSIBLE", new LotteryTicket().buy(4, 1, 2, 3, 5));
    ExampleRunner.eq(170, "POSSIBLE", new LotteryTicket().buy(300, 100, 100, 1, 100));
    ExampleRunner.eq(171, "POSSIBLE", new LotteryTicket().buy(6, 1, 100, 2, 3));
    ExampleRunner.eq(172, "POSSIBLE", new LotteryTicket().buy(5, 2, 2, 3, 4));
    ExampleRunner.eq(173, "POSSIBLE", new LotteryTicket().buy(11, 1, 2, 4, 8));
    ExampleRunner.eq(174, "POSSIBLE", new LotteryTicket().buy(50, 15, 15, 60, 20));
    ExampleRunner.eq(175, "POSSIBLE", new LotteryTicket().buy(22, 5, 6, 10, 11));
    ExampleRunner.eq(176, "POSSIBLE", new LotteryTicket().buy(11, 5, 10, 2, 1));
    ExampleRunner.eq(177, "POSSIBLE", new LotteryTicket().buy(1000, 50, 300, 100, 700));
    ExampleRunner.eq(178, "POSSIBLE", new LotteryTicket().buy(7, 1, 3, 77, 3));
    ExampleRunner.eq(179, "POSSIBLE", new LotteryTicket().buy(1001, 1, 500, 400, 1000));
    ExampleRunner.eq(180, "POSSIBLE", new LotteryTicket().buy(13, 3, 7, 10, 15));
    ExampleRunner.eq(181, "POSSIBLE", new LotteryTicket().buy(20, 16, 12, 11, 8));
    ExampleRunner.eq(182, "POSSIBLE", new LotteryTicket().buy(3, 1, 1, 4, 1));
    ExampleRunner.eq(183, "POSSIBLE", new LotteryTicket().buy(1101, 1, 10, 100, 1000));
    ExampleRunner.eq(184, "POSSIBLE", new LotteryTicket().buy(10, 3, 4, 6, 9));
    ExampleRunner.eq(185, "POSSIBLE", new LotteryTicket().buy(3, 1, 10, 1, 1));
    ExampleRunner.eq(186, "POSSIBLE", new LotteryTicket().buy(100, 50, 25, 1, 25));
    ExampleRunner.eq(187, "POSSIBLE", new LotteryTicket().buy(31, 1, 10, 13, 20));
    ExampleRunner.eq(188, "POSSIBLE", new LotteryTicket().buy(20, 30, 10, 5, 5));
    ExampleRunner.eq(189, "POSSIBLE", new LotteryTicket().buy(10, 6, 50, 2, 2));
    ExampleRunner.eq(190, "POSSIBLE", new LotteryTicket().buy(25, 1, 29, 9, 15));
    ExampleRunner.eq(191, "POSSIBLE", new LotteryTicket().buy(10, 3, 1, 3, 4));
    ExampleRunner.eq(192, "IMPOSSIBLE", new LotteryTicket().buy(2, 1, 100, 100, 100));
  }

}
